package com.example.sixgod;

import android.annotation.SuppressLint;
import android.content.Intent;
import android.os.Bundle;
import android.text.method.ScrollingMovementMethod;
import android.widget.TextView;

import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;

public class MainActivity2 extends AppCompatActivity {
    private guaDatabase guaDatabase;
    private TextView guaTextView,title;

    @SuppressLint("MissingInflatedId")
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        guaDatabase = guaDatabase.getInstance(this);
        setContentView(R.layout.activity_main2);
        Intent intent=getIntent();
        int[] numbers=intent.getIntArrayExtra("numers");
        StringBuffer sixgod=new StringBuffer();
        for (int number : numbers) {
            if(number==0||number==2){
                sixgod.append(1);
            }else if(number==1||number==3){
                sixgod.append(2);
            }
        }
        guaxiang guaByValue = guaDatabase.guaDao().getGuaByValue(sixgod.toString());
        guaTextView = findViewById(R.id.textView);

        title = findViewById(R.id.textView2);
        title.setText(guaByValue.getName());
        guaTextView.setText(guaByValue.getGuan());
        guaTextView.setMovementMethod(ScrollingMovementMethod.getInstance());

    }
}